package com.example.ipcxunyou;

import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.ipccore.ServiceManager;
import com.example.ipcxunyou.bean.UserInfo;

public class SecondActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });

        ServiceManager.getDefault().open(this);
    }

    //服务发现
    public void onClickServerFind(View view) {
        IUserManager userManager = ServiceManager.getDefault().getInstance(IUserManager.class);
        UserInfo user = userManager.getUser();
        Log.e("xunyou", "onClickServerFind=>服务调用，获取返回值：  "+user.toString());
    }
}